﻿// MIT License
// 开源地址：https://gitee.com/co1024/AbcMvc
// Copyright (c) 2021-2023 1024
// Abc.Mvc=Furion+EF+SqlSugar+Pear layui admin.

using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional

namespace Abc.EntityFramework.Migrations.Migrations
{
    /// <inheritdoc />
    public partial class init : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Sys_DataConfig",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false, comment: "ID")
                        .Annotation("Sqlite:Autoincrement", true),
                    ExtensionData = table.Column<string>(type: "TEXT", nullable: true, comment: "Json数据"),
                    PId = table.Column<long>(type: "INTEGER", nullable: false, comment: "父Id"),
                    Key = table.Column<string>(type: "TEXT", nullable: true, comment: "关键词"),
                    PKey = table.Column<string>(type: "TEXT", nullable: true, comment: "PKey"),
                    Name = table.Column<string>(type: "TEXT", nullable: true, comment: "名称"),
                    Value = table.Column<string>(type: "TEXT", nullable: true, comment: "值"),
                    ValueEx = table.Column<string>(type: "TEXT", nullable: true, comment: "值扩展"),
                    GroupName = table.Column<string>(type: "TEXT", nullable: true, comment: "分组"),
                    Sort = table.Column<int>(type: "INTEGER", nullable: false, comment: "排序"),
                    IsEnable = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否启用"),
                    Remark = table.Column<string>(type: "TEXT", nullable: true, comment: "备注"),
                    Level = table.Column<int>(type: "INTEGER", nullable: false, comment: "层级"),
                    LevelPath = table.Column<string>(type: "TEXT", nullable: true, comment: "层级路径"),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间"),
                    UpdateUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "更新用户ID"),
                    UpdateUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "更新用户"),
                    UpdateTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "更新时间"),
                    IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, comment: "默认假删除"),
                    DeletedUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "删除用户ID"),
                    DeletedUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "删除用户"),
                    DeletedTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "删除时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_DataConfig", x => x.Id);
                },
                comment: "数据配置");

            migrationBuilder.CreateTable(
                name: "Sys_EmailSendConfig",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false, comment: "ID")
                        .Annotation("Sqlite:Autoincrement", true),
                    ExtensionData = table.Column<string>(type: "TEXT", nullable: true, comment: "Json数据"),
                    IsEnable = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否启用"),
                    EmailSmtpHost = table.Column<string>(type: "TEXT", nullable: true, comment: "SMTP服务器"),
                    EmailSmtpPort = table.Column<string>(type: "TEXT", nullable: true, comment: "邮件服务器Smtp端口"),
                    EmailAccount = table.Column<string>(type: "TEXT", nullable: true, comment: "邮箱账号"),
                    EmailPassword = table.Column<string>(type: "TEXT", nullable: true, comment: "邮箱密码"),
                    EmailIsHtml = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否包含Html代码"),
                    EmailDisplayName = table.Column<string>(type: "TEXT", nullable: true, comment: "发送者显示名"),
                    EmailIsSsl = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否启用SSL加密"),
                    Remark = table.Column<string>(type: "TEXT", nullable: true, comment: "备注"),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间"),
                    UpdateUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "更新用户ID"),
                    UpdateUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "更新用户"),
                    UpdateTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "更新时间"),
                    IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, comment: "默认假删除"),
                    DeletedUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "删除用户ID"),
                    DeletedUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "删除用户"),
                    DeletedTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "删除时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_EmailSendConfig", x => x.Id);
                },
                comment: "邮件发送配置");

            migrationBuilder.CreateTable(
                name: "Sys_EmailSendRecord",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false, comment: "ID")
                        .Annotation("Sqlite:Autoincrement", true),
                    ExtensionData = table.Column<string>(type: "TEXT", nullable: true, comment: "Json数据"),
                    DataId = table.Column<long>(type: "INTEGER", nullable: false, comment: "关联ID"),
                    TemplateType = table.Column<int>(type: "INTEGER", nullable: false, comment: "邮件模板类型"),
                    Subject = table.Column<string>(type: "TEXT", maxLength: 300, nullable: true, comment: "主题"),
                    Content = table.Column<string>(type: "TEXT", nullable: true, comment: "内容"),
                    SenderName = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true, comment: "邮件发送名称"),
                    SenderEmail = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true, comment: "邮件发送账号"),
                    ReceiveName = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true, comment: "收件人"),
                    ReceiveEmail = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true, comment: "收件邮箱"),
                    State = table.Column<int>(type: "INTEGER", nullable: false, comment: "邮件发送状态"),
                    SendResult = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true, comment: "发送结果"),
                    SendNum = table.Column<int>(type: "INTEGER", nullable: false, comment: "发送次数"),
                    SendMaxNum = table.Column<int>(type: "INTEGER", nullable: false, comment: "最大发送次数"),
                    VerCode = table.Column<string>(type: "TEXT", nullable: true, comment: "验证码"),
                    IsUse = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否使用"),
                    ExpireTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "过期时间"),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间"),
                    UpdateUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "更新用户ID"),
                    UpdateUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "更新用户"),
                    UpdateTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "更新时间"),
                    IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, comment: "默认假删除"),
                    DeletedUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "删除用户ID"),
                    DeletedUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "删除用户"),
                    DeletedTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "删除时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_EmailSendRecord", x => x.Id);
                },
                comment: "邮件发送记录");

            migrationBuilder.CreateTable(
                name: "Sys_EmailTemplate",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false, comment: "ID")
                        .Annotation("Sqlite:Autoincrement", true),
                    ExtensionData = table.Column<string>(type: "TEXT", nullable: true, comment: "Json数据"),
                    TemplateType = table.Column<int>(type: "INTEGER", nullable: false, comment: "邮件模板类型"),
                    IsEnable = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否启用"),
                    Title = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true, comment: "邮件标题"),
                    Content = table.Column<string>(type: "TEXT", nullable: true, comment: "邮件内容"),
                    Code = table.Column<string>(type: "TEXT", nullable: true, comment: "编号"),
                    IsVerCode = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否需验证码"),
                    TableId = table.Column<long>(type: "INTEGER", nullable: true, comment: "表ID"),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间"),
                    UpdateUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "更新用户ID"),
                    UpdateUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "更新用户"),
                    UpdateTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "更新时间"),
                    IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, comment: "默认假删除"),
                    DeletedUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "删除用户ID"),
                    DeletedUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "删除用户"),
                    DeletedTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "删除时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_EmailTemplate", x => x.Id);
                },
                comment: "邮件模板");

            migrationBuilder.CreateTable(
                name: "Sys_File",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false, comment: "ID")
                        .Annotation("Sqlite:Autoincrement", true),
                    Name = table.Column<string>(type: "TEXT", nullable: true, comment: "名称"),
                    Format = table.Column<string>(type: "TEXT", nullable: true, comment: "格式"),
                    Size = table.Column<long>(type: "INTEGER", nullable: false, comment: "大小"),
                    Type = table.Column<string>(type: "TEXT", nullable: true, comment: "分类"),
                    FileObjectName = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true, comment: "存储到bucket的名称"),
                    FilePath = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true, comment: "存储路径"),
                    DataId = table.Column<long>(type: "INTEGER", nullable: false, comment: "来源数据ID"),
                    DataType = table.Column<string>(type: "TEXT", nullable: true, comment: "来源数据类型"),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间"),
                    UpdateUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "更新用户ID"),
                    UpdateUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "更新用户"),
                    UpdateTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "更新时间"),
                    IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, comment: "默认假删除"),
                    DeletedUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "删除用户ID"),
                    DeletedUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "删除用户"),
                    DeletedTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "删除时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_File", x => x.Id);
                },
                comment: "文件");

            migrationBuilder.CreateTable(
                name: "Sys_FileSetting",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false, comment: "ID")
                        .Annotation("Sqlite:Autoincrement", true),
                    FileLocation = table.Column<int>(type: "INTEGER", nullable: false, comment: "文件存储位置"),
                    Aliyun_FileBucketName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true, comment: "文件仓库"),
                    Aliyun_AccessKeyId = table.Column<string>(type: "TEXT", nullable: true),
                    Aliyun_AccessKeySecret = table.Column<string>(type: "TEXT", nullable: true),
                    Aliyun_Endpoint = table.Column<string>(type: "TEXT", nullable: true),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间"),
                    UpdateUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "更新用户ID"),
                    UpdateUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "更新用户"),
                    UpdateTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "更新时间"),
                    IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, comment: "默认假删除"),
                    DeletedUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "删除用户ID"),
                    DeletedUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "删除用户"),
                    DeletedTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "删除时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_FileSetting", x => x.Id);
                },
                comment: "文件设置");

            migrationBuilder.CreateTable(
                name: "Sys_Localization",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false, comment: "ID")
                        .Annotation("Sqlite:Autoincrement", true),
                    Title = table.Column<string>(type: "TEXT", nullable: true, comment: "标题类型"),
                    Remark = table.Column<string>(type: "TEXT", nullable: true, comment: "备注"),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间"),
                    UpdateUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "更新用户ID"),
                    UpdateUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "更新用户"),
                    UpdateTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "更新时间"),
                    IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, comment: "默认假删除"),
                    DeletedUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "删除用户ID"),
                    DeletedUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "删除用户"),
                    DeletedTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "删除时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Localization", x => x.Id);
                },
                comment: "全球化和本地化");

            migrationBuilder.CreateTable(
                name: "Sys_Menu",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false, comment: "ID")
                        .Annotation("Sqlite:Autoincrement", true),
                    MenuAreaType = table.Column<int>(type: "INTEGER", nullable: false),
                    Code = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true, comment: "菜单ID"),
                    PCode = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true, comment: "父Id"),
                    Area = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true, comment: "区域"),
                    Name = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true, comment: "菜单名称"),
                    IsEnable = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否可用"),
                    Icon = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true, comment: "图标"),
                    Sort = table.Column<int>(type: "INTEGER", nullable: false, comment: "顺序"),
                    Url = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true, comment: "Url"),
                    Controller = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true, comment: "控制器"),
                    Actions = table.Column<string>(type: "TEXT", maxLength: 300, nullable: true, comment: "方法/Action名称,多个用英文逗号隔开"),
                    OpenType = table.Column<int>(type: "INTEGER", nullable: false),
                    Remark = table.Column<string>(type: "TEXT", nullable: true, comment: "备注"),
                    IsExpand = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否展开菜单"),
                    MenuType = table.Column<int>(type: "INTEGER", nullable: false, comment: "节点类型(菜单、工具栏)"),
                    IsDisuse = table.Column<bool>(type: "INTEGER", nullable: false),
                    IsSystem = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否系统菜单"),
                    IsShow = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否显示"),
                    IsAutoGeneration = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否自动生成"),
                    IsControllerCatalogue = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否控制器目录"),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间"),
                    UpdateUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "更新用户ID"),
                    UpdateUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "更新用户"),
                    UpdateTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "更新时间"),
                    IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, comment: "默认假删除"),
                    DeletedUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "删除用户ID"),
                    DeletedUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "删除用户"),
                    DeletedTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "删除时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Menu", x => x.Id);
                },
                comment: "菜单");

            migrationBuilder.CreateTable(
                name: "Sys_Role",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false, comment: "ID")
                        .Annotation("Sqlite:Autoincrement", true),
                    Code = table.Column<string>(type: "TEXT", nullable: true, comment: "标识"),
                    Name = table.Column<string>(type: "TEXT", nullable: true, comment: "名称"),
                    Sort = table.Column<int>(type: "INTEGER", nullable: false, comment: "排序"),
                    IsEnable = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否启用"),
                    Remark = table.Column<string>(type: "TEXT", nullable: true, comment: "备注"),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间"),
                    UpdateUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "更新用户ID"),
                    UpdateUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "更新用户"),
                    UpdateTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "更新时间"),
                    IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, comment: "默认假删除"),
                    DeletedUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "删除用户ID"),
                    DeletedUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "删除用户"),
                    DeletedTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "删除时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_Role", x => x.Id);
                },
                comment: "角色");

            migrationBuilder.CreateTable(
                name: "Sys_User",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false, comment: "ID")
                        .Annotation("Sqlite:Autoincrement", true),
                    Account = table.Column<string>(type: "TEXT", nullable: true, comment: "用户名"),
                    Pwd = table.Column<string>(type: "TEXT", nullable: true, comment: "密码"),
                    UserType = table.Column<int>(type: "INTEGER", nullable: false, comment: "账户类型"),
                    IsEnable = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否启用"),
                    IsTest = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否测试"),
                    Nick = table.Column<string>(type: "TEXT", nullable: true, comment: "昵称"),
                    Email = table.Column<string>(type: "TEXT", nullable: true, comment: "邮箱"),
                    Province = table.Column<string>(type: "TEXT", nullable: true, comment: "省份"),
                    City = table.Column<string>(type: "TEXT", nullable: true, comment: "城市"),
                    Town = table.Column<string>(type: "TEXT", nullable: true, comment: "镇"),
                    Address = table.Column<string>(type: "TEXT", nullable: true, comment: "详细地址"),
                    Phone = table.Column<string>(type: "TEXT", nullable: true, comment: "联系电话"),
                    Tel = table.Column<string>(type: "TEXT", nullable: true, comment: "办公电话"),
                    Remark = table.Column<string>(type: "TEXT", nullable: true, comment: "备注"),
                    LastLoginTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "最后登录时间"),
                    LastLoginIp = table.Column<string>(type: "TEXT", nullable: true, comment: "最后登录IP"),
                    LastLoginUserAgent = table.Column<string>(type: "TEXT", nullable: true, comment: "最后登录用户浏览器信息"),
                    IsSwagger = table.Column<bool>(type: "INTEGER", nullable: false, comment: "是否可以使用Sagger"),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间"),
                    UpdateUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "更新用户ID"),
                    UpdateUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "更新用户"),
                    UpdateTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "更新时间"),
                    IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, comment: "默认假删除"),
                    DeletedUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "删除用户ID"),
                    DeletedUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "删除用户"),
                    DeletedTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "删除时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_User", x => x.Id);
                },
                comment: "用户");

            migrationBuilder.CreateTable(
                name: "Sys_LocalizationTranslation",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false, comment: "ID")
                        .Annotation("Sqlite:Autoincrement", true),
                    Culture = table.Column<string>(type: "TEXT", nullable: true, comment: "区域码"),
                    Translation = table.Column<string>(type: "TEXT", nullable: true, comment: "翻译"),
                    Remark = table.Column<string>(type: "TEXT", nullable: true, comment: "备注"),
                    LocalizationId = table.Column<long>(type: "INTEGER", nullable: false, comment: "全球化和本地化Id"),
                    SysLocalizationId = table.Column<long>(type: "INTEGER", nullable: true),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间"),
                    UpdateUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "更新用户ID"),
                    UpdateUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "更新用户"),
                    UpdateTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "更新时间"),
                    IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, comment: "默认假删除"),
                    DeletedUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "删除用户ID"),
                    DeletedUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "删除用户"),
                    DeletedTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: true, comment: "删除时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_LocalizationTranslation", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Sys_LocalizationTranslation_Sys_Localization_LocalizationId",
                        column: x => x.LocalizationId,
                        principalTable: "Sys_Localization",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Sys_LocalizationTranslation_Sys_Localization_SysLocalizationId",
                        column: x => x.SysLocalizationId,
                        principalTable: "Sys_Localization",
                        principalColumn: "Id");
                },
                comment: "全球化和本地化 翻译");

            migrationBuilder.CreateTable(
                name: "Sys_RoleMenu",
                columns: table => new
                {
                    RoleId = table.Column<long>(type: "INTEGER", nullable: false, comment: "角色Id"),
                    MenuId = table.Column<long>(type: "INTEGER", nullable: false, comment: "功能/权限Id"),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_RoleMenu", x => new { x.MenuId, x.RoleId });
                    table.ForeignKey(
                        name: "FK_Sys_RoleMenu_Sys_Menu_MenuId",
                        column: x => x.MenuId,
                        principalTable: "Sys_Menu",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Sys_RoleMenu_Sys_Role_RoleId",
                        column: x => x.RoleId,
                        principalTable: "Sys_Role",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "角色权限");

            migrationBuilder.CreateTable(
                name: "Sys_UserRole",
                columns: table => new
                {
                    UserId = table.Column<long>(type: "INTEGER", nullable: false, comment: "用户Id"),
                    RoleId = table.Column<long>(type: "INTEGER", nullable: false, comment: "角色Id"),
                    CreatorUserId = table.Column<long>(type: "INTEGER", nullable: true, comment: "创建用户ID"),
                    CreatorUserName = table.Column<string>(type: "TEXT", nullable: true, comment: "创建用户"),
                    CreationTime = table.Column<DateTimeOffset>(type: "TEXT", nullable: false, comment: "创建时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_UserRole", x => new { x.UserId, x.RoleId });
                    table.ForeignKey(
                        name: "FK_Sys_UserRole_Sys_Role_RoleId",
                        column: x => x.RoleId,
                        principalTable: "Sys_Role",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Sys_UserRole_Sys_User_UserId",
                        column: x => x.UserId,
                        principalTable: "Sys_User",
                        principalColumn: "Id");
                },
                comment: "用户角色");

            migrationBuilder.InsertData(
                table: "Sys_DataConfig",
                columns: new[] { "Id", "CreationTime", "CreatorUserId", "CreatorUserName", "DeletedTime", "DeletedUserId", "DeletedUserName", "ExtensionData", "GroupName", "IsDeleted", "IsEnable", "Key", "Level", "LevelPath", "Name", "PId", "PKey", "Remark", "Sort", "UpdateTime", "UpdateUserId", "UpdateUserName", "Value", "ValueEx" },
                values: new object[,]
                {
                    { 1L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1152), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "SystemSetting", 0, null, "系统设置", 0L, "", null, 0, null, null, null, "", null },
                    { 2L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1342), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, "CodeGenerateConfig", false, true, "CodeGenerateConfig", 0, null, "代码生成配置", 0L, "", null, 0, null, null, null, "", null },
                    { 3L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1347), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, "DbDifferenceTableConfig", false, true, "DbDifferenceTableConfig", 0, null, "数据库差异对比设置", 0L, "", null, 0, null, null, null, "", null },
                    { 1001L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1348), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "WebName", 0, null, "网站名称", 0L, "SysSetting", null, 0, null, null, null, "ABC Admin", null },
                    { 1002L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1355), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "WebDomain", 0, null, "网站域名", 0L, "SysSetting", null, 0, null, null, null, "", null },
                    { 1003L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1363), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "WebLogo", 0, null, "网站logo", 0L, "SysSetting", null, 0, null, null, null, "", null },
                    { 1004L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1364), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "DatabaseBackupPath", 0, null, "数据库备份路径", 0L, "SysSetting", null, 0, null, null, null, "dbblack", null },
                    { 1005L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1366), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "DatabaseBackupSwitch", 0, null, "数据库备份开关", 0L, "SysSetting", null, 0, null, null, null, "false", null },
                    { 1006L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1368), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "DatabaseBackupTime", 0, null, "数据库备份时间", 0L, "SysSetting", null, 0, null, null, null, "02:00", null },
                    { 1007L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1370), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "WebBeianNo", 0, null, "网站备案号", 0L, "SysSetting", null, 0, null, null, null, "", null },
                    { 1008L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1372), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "ContactUs", 0, null, "联系我们", 0L, "SysSetting", null, 0, null, null, null, "", null },
                    { 1009L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1375), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "AboutUs", 0, null, "关于我们", 0L, "SysSetting", null, 0, null, null, null, "", null },
                    { 1010L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1377), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "HelpCenter", 0, null, "帮助中心", 0L, "SysSetting", null, 0, null, null, null, "", null },
                    { 1011L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1378), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "MetaKeywords", 0, null, "META关键词", 0L, "SysSetting", null, 0, null, null, null, "公司,ABC", null },
                    { 1012L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1380), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "MetaDescribe", 0, null, "META描述", 0L, "SysSetting", null, 0, null, null, null, "ABC Admin", null },
                    { 1013L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1382), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "CopyrightInformation", 0, null, "版权信息", 0L, "SysSetting", null, 0, null, null, null, "©2012-2022 ABC Admin 版权所有", null },
                    { 1014L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 213, DateTimeKind.Unspecified).AddTicks(1384), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, null, null, false, true, "IsOpenIpBlack", 0, null, "是否开启IP黑名单", 0L, "SysSetting", null, 0, null, null, null, "true", null }
                });

            migrationBuilder.InsertData(
                table: "Sys_EmailSendConfig",
                columns: new[] { "Id", "CreationTime", "CreatorUserId", "CreatorUserName", "DeletedTime", "DeletedUserId", "DeletedUserName", "EmailAccount", "EmailDisplayName", "EmailIsHtml", "EmailIsSsl", "EmailPassword", "EmailSmtpHost", "EmailSmtpPort", "ExtensionData", "IsDeleted", "IsEnable", "Remark", "UpdateTime", "UpdateUserId", "UpdateUserName" },
                values: new object[] { 1L, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 169, DateTimeKind.Unspecified).AddTicks(520), new TimeSpan(0, 8, 0, 0, 0)), 0L, "", null, null, null, "abc@qq.com", "Abc.Admin", true, true, "123123", "smtp.qq.com", "465", null, false, true, null, null, null, null });

            migrationBuilder.InsertData(
                table: "Sys_Menu",
                columns: new[] { "Id", "Actions", "Area", "Code", "Controller", "CreationTime", "CreatorUserId", "CreatorUserName", "DeletedTime", "DeletedUserId", "DeletedUserName", "Icon", "IsAutoGeneration", "IsControllerCatalogue", "IsDeleted", "IsDisuse", "IsEnable", "IsExpand", "IsShow", "IsSystem", "MenuAreaType", "MenuType", "Name", "OpenType", "PCode", "Remark", "Sort", "UpdateTime", "UpdateUserId", "UpdateUserName", "Url" },
                values: new object[,]
                {
                    { 1L, null, "HtAdmin", "HtAdmin_System", null, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 196, DateTimeKind.Unspecified).AddTicks(6353), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, "layui-icon layui-icon-set-fill", false, false, false, false, true, false, true, false, 0, 0, "系统管理", 0, "HtAdmin", null, 1, null, null, null, null },
                    { 2L, null, "HtAdmin", "HtAdmin_User", null, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 196, DateTimeKind.Unspecified).AddTicks(6378), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, "layui-icon layui-icon-user", false, false, false, false, true, false, true, false, 0, 0, "用户管理", 0, "HtAdmin", null, 2, null, null, null, null },
                    { 3L, null, "HtAdmin", "HtAdmin_NoticeLog", null, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 196, DateTimeKind.Unspecified).AddTicks(6382), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, "layui-icon layui-icon-log", false, false, false, false, true, false, true, false, 0, 0, "通知日志", 0, "HtAdmin", null, 5, null, null, null, null },
                    { 4L, null, "HtAdmin", "HtAdmin_Statistics", null, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 196, DateTimeKind.Unspecified).AddTicks(6384), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, "layui-icon layui-icon-chart", false, false, false, false, true, false, true, false, 0, 0, "数据统计", 0, "HtAdmin", null, 6, null, null, null, null },
                    { 5L, null, "HtAdmin", "HtAdmin_Developer", null, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 196, DateTimeKind.Unspecified).AddTicks(6386), new TimeSpan(0, 8, 0, 0, 0)), null, null, null, null, null, "layui-icon layui-icon-util", false, false, false, false, true, false, true, false, 0, 0, "开发工具", 0, "HtAdmin", null, 7, null, null, null, null }
                });

            migrationBuilder.InsertData(
                table: "Sys_User",
                columns: new[] { "Id", "Account", "Address", "City", "CreationTime", "CreatorUserId", "CreatorUserName", "DeletedTime", "DeletedUserId", "DeletedUserName", "Email", "IsDeleted", "IsEnable", "IsSwagger", "IsTest", "LastLoginIp", "LastLoginTime", "LastLoginUserAgent", "Nick", "Phone", "Province", "Pwd", "Remark", "Tel", "Town", "UpdateTime", "UpdateUserId", "UpdateUserName", "UserType" },
                values: new object[,]
                {
                    { 1L, "developer", null, null, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 209, DateTimeKind.Unspecified).AddTicks(3079), new TimeSpan(0, 8, 0, 0, 0)), 0L, "", null, null, null, null, false, true, false, false, null, null, null, "超级管理员", null, null, "0UQfMwNkT0mPLJSo8Mw1eAHS4wtZIq42ISjF8rep1c8oU0XgVLD9RFjp/qB+ljcIZBydWbrXQaBnL56KsCW5c+2br4S5TVZI7FioAyU2pNN0", null, null, null, null, null, null, 101 },
                    { 2L, "administrator", null, null, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 209, DateTimeKind.Unspecified).AddTicks(3144), new TimeSpan(0, 8, 0, 0, 0)), 0L, "", null, null, null, null, false, true, false, false, null, null, null, "超级管理员", null, null, "znW46rfrC067kXuyCdn5OwGMMitce3qVmwlAaX73EFQd9tQhQEU81+dR6xDYRt5V0qFu1IGzRCsA/HxCMiGRyxdip8Cmr1wLLjeYT62RuDLn", null, null, null, null, null, null, 99 },
                    { 3L, "testuser", null, null, new DateTimeOffset(new DateTime(2023, 7, 14, 18, 45, 44, 209, DateTimeKind.Unspecified).AddTicks(3147), new TimeSpan(0, 8, 0, 0, 0)), 0L, "", null, null, null, null, false, true, false, false, null, null, null, "测试用户", null, null, "pdgMbIolRUmdJylMpIbe6wG4VSjw0TCvHvyW9DHU3TbU2ttLgPiZKU4KxSukopsoEgAidBRxv9qObWkH3VlNgeelUUH/L/9IzLYEngwdtJTF", null, null, null, null, null, null, 0 }
                });

            migrationBuilder.CreateIndex(
                name: "IX_Sys_EmailSendRecord_DataId",
                table: "Sys_EmailSendRecord",
                column: "DataId");

            migrationBuilder.CreateIndex(
                name: "IX_Sys_EmailSendRecord_ReceiveEmail",
                table: "Sys_EmailSendRecord",
                column: "ReceiveEmail");

            migrationBuilder.CreateIndex(
                name: "IX_Sys_EmailSendRecord_SenderEmail",
                table: "Sys_EmailSendRecord",
                column: "SenderEmail");

            migrationBuilder.CreateIndex(
                name: "IX_Sys_LocalizationTranslation_LocalizationId",
                table: "Sys_LocalizationTranslation",
                column: "LocalizationId");

            migrationBuilder.CreateIndex(
                name: "IX_Sys_LocalizationTranslation_SysLocalizationId",
                table: "Sys_LocalizationTranslation",
                column: "SysLocalizationId");

            migrationBuilder.CreateIndex(
                name: "IX_Sys_Role_Name",
                table: "Sys_Role",
                column: "Name");

            migrationBuilder.CreateIndex(
                name: "IX_Sys_RoleMenu_RoleId",
                table: "Sys_RoleMenu",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "IX_Sys_User_Account_UserType",
                table: "Sys_User",
                columns: new[] { "Account", "UserType" });

            migrationBuilder.CreateIndex(
                name: "IX_Sys_User_Email_Phone",
                table: "Sys_User",
                columns: new[] { "Email", "Phone" });

            migrationBuilder.CreateIndex(
                name: "IX_Sys_User_Tel_Nick",
                table: "Sys_User",
                columns: new[] { "Tel", "Nick" });

            migrationBuilder.CreateIndex(
                name: "IX_Sys_UserRole_RoleId",
                table: "Sys_UserRole",
                column: "RoleId");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Sys_DataConfig");

            migrationBuilder.DropTable(
                name: "Sys_EmailSendConfig");

            migrationBuilder.DropTable(
                name: "Sys_EmailSendRecord");

            migrationBuilder.DropTable(
                name: "Sys_EmailTemplate");

            migrationBuilder.DropTable(
                name: "Sys_File");

            migrationBuilder.DropTable(
                name: "Sys_FileSetting");

            migrationBuilder.DropTable(
                name: "Sys_LocalizationTranslation");

            migrationBuilder.DropTable(
                name: "Sys_RoleMenu");

            migrationBuilder.DropTable(
                name: "Sys_UserRole");

            migrationBuilder.DropTable(
                name: "Sys_Localization");

            migrationBuilder.DropTable(
                name: "Sys_Menu");

            migrationBuilder.DropTable(
                name: "Sys_Role");

            migrationBuilder.DropTable(
                name: "Sys_User");
        }
    }
}
